<script lang="ts" name="CognitiveFunctionScreening" setup>
import dDialog from '@/components/dDialog/dDialog.vue'
import {ref} from 'vue'
import {useRoute} from 'vue-router'
const route = useRoute()
// 禁止编辑
const disEdit = ref<boolean>(Boolean(route.query.disEdit))

const props = defineProps({
  //显示
  showDialog: {
    type: Boolean,
    required: true
  },
  // 老年人认知功能初筛数据
  odCognCribble: {
    type: String,
    required: true
  }
})

const emits = defineEmits(['close', 'confirm'])

//老年人认知功能粗筛
const cognitiveFunctionScreening = ref(props.odCognCribble?.split('|')[0] || '1')
// 再次老年人认知功能粗筛
const cognitiveFunctionScreeningAgain = ref(props.odCognCribble?.split('|')[1] || '1')

/**
 * @description: 关闭弹窗
 * @return {*}
 */
const onCancel = () => {
  emits('close')
}
/**
 * @description: 关闭弹窗
 * @return {*}
 */
const onClose = () => {
  emits('close')
}

/**
 * @description: 保存
 * @return {*}
 */
const onConfirm = () => {
  emits('confirm', {
    cognitiveFunctionScreening: cognitiveFunctionScreening.value,
    cognitiveFunctionScreeningAgain: cognitiveFunctionScreeningAgain.value
  })
  emits('close')
}
</script>
<template>
  <d-dialog
    title="老年人认知功能-粗筛"
    :show-dialog="showDialog"
    :width="600"
    :hide-save-btn="disEdit"
    @cancel="onCancel"
    @close="onClose"
    @confirm="onConfirm"
  >
    <div class="title">
      1、告诉被检查者“我将要说三件物品的名称（如铅笔、卡车、书），请您立刻重复”
    </div>
    <span class="result">重复结果</span>
    <el-radio-group v-model="cognitiveFunctionScreening" :disabled="disEdit">
      <el-radio label="1">
        准确
      </el-radio>
      <el-radio label="2">
        错误
      </el-radio>
    </el-radio-group>
    <div class="title">
      2、过一分钟后请其再次重复刚才三件物品的名称
    </div>
    <span class="result">重复结果</span>
    <el-radio-group v-model="cognitiveFunctionScreeningAgain" :disabled="disEdit">
      <el-radio label="1">
        准确
      </el-radio>
      <el-radio label="2">
        错误
      </el-radio>
    </el-radio-group>
  </d-dialog>
</template>

<style scoped lang="less">
.title {
  font-weight: bold;
  margin: 5px 0;
}
.result {
  margin: 0 25px;
  display: inline-block;
  height: 32px;
  line-height: 32px;
}
</style>
